package Day202;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/5
 */
public class Demo3 {
    public static void main(String[] args) {
        System.out.println("请输入一个数字：");
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        System.out.println("你输入的数字是："+a);

        int[] arr = {2,1,4,7};
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
